//
//  LZHotOrNewTableViewCell.m
//  沙哈拉FM
//
//  Created by dllo on 15/11/9.
//  Copyright © 2015年 S1mpl3. All rights reserved.
//

#import "LZHotOrNewTableViewCell.h"
#import "FitHeader.h"
#import "UIImageView+WebCache.h"
@implementation LZHotOrNewTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}
- (void)createView{
    _largeLogoImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:_largeLogoImageView];
    
    _nicknameLabel = [[BaseLabel alloc]init];
    [self.contentView addSubview:_nicknameLabel];
    
    _personDescribeLabel = [[BaseLabel alloc]init];
    [_personDescribeLabel setFontSize:15];
    _personDescribeLabel.alpha = .7;
    [self.contentView addSubview:_personDescribeLabel];
    
    _tracksCountsImageView = [[UIImageView alloc]init];
    _tracksCountsImageView.image = [UIImage imageNamed:@"iconfont-jishu"];
    [self.contentView addSubview:_tracksCountsImageView];
    
    _tracksCountsLabel = [[BaseLabel alloc]init];
    [_tracksCountsLabel setFontSize:15];
    _tracksCountsLabel.alpha = .7;
    [self.contentView addSubview:_tracksCountsLabel];
    
    _followersImageView = [[UIImageView alloc]init];
    _followersImageView.image = [UIImage imageNamed:@"iconfont-pengyou"];
    [self.contentView addSubview:_followersImageView];
    
    _followersCountsLabel = [[BaseLabel alloc]init];
    [_followersCountsLabel setFontSize:15];
    _followersCountsLabel.alpha = .7;
    [self.contentView addSubview:_followersCountsLabel];
    
//    _attentionButton = [BaseButton buttonWithType:UIButtonTypeSystem];
//    [_attentionButton setTitle:@"关注" forState:UIControlStateNormal];
//    [_attentionButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//    _attentionButton.layer.borderWidth = 1.0;
//    _attentionButton.layer.borderColor = [UIColor redColor].CGColor;
//    [self.contentView addSubview:_attentionButton];
}
- (void)layoutSubviews{
    [super layoutSubviews];
    _largeLogoImageView.frame = CGRectMake(5 * FITWidth, 5 * FITHeight, 120 * FITWidth, 120 * FITHeight);
    _nicknameLabel.frame = CGRectMake(_largeLogoImageView.frame.origin.x + _largeLogoImageView.frame.size.width + 10 * FITWidth, _largeLogoImageView.frame.origin.y + 5 * FITHeight, 230 * FITWidth, 30 * FITHeight);
    _personDescribeLabel.frame = CGRectMake(_nicknameLabel.frame.origin.x, _nicknameLabel.frame.origin.y + _nicknameLabel.frame.size.height + 10 * FITHeight, _nicknameLabel.frame.size.width, 30 * FITHeight);
    _tracksCountsImageView.frame = CGRectMake(_personDescribeLabel.frame.origin.x, _personDescribeLabel.frame.origin.y + _personDescribeLabel.frame.size.height + 10 * FITHeight, 20 * FITWidth, 20 * FITHeight);
    _tracksCountsLabel.frame = CGRectMake(_tracksCountsImageView.frame.origin.x + _tracksCountsImageView.frame.size.width, _tracksCountsImageView.frame.origin.y, 40 * FITWidth, _tracksCountsImageView.frame.size.height);
    _followersImageView.frame = CGRectMake(_tracksCountsLabel.frame.origin.x + _tracksCountsLabel.frame.size.width, _tracksCountsLabel.frame.origin.y, _tracksCountsImageView.frame.size.width, _tracksCountsLabel.frame.size.height);
    _followersCountsLabel.frame = CGRectMake(_followersImageView.frame.origin.x + _followersImageView.frame.size.width, _followersImageView.frame.origin.y, 60 * FITWidth, _followersImageView.frame.size.height);
//    _attentionButton.frame = CGRectMake(_followersCountsLabel.frame.origin.x + _followersCountsLabel.frame.size.width + 20 * FITWidth, _followersCountsLabel.frame.origin.y, 50 * FITWidth, 25 * FITHeight);
}
- (void)setHostList:(TheHostList *)hostList{
    _nicknameLabel.text = hostList.nickname;
    [_largeLogoImageView sd_setImageWithURL:[NSURL URLWithString:hostList.largeLogo] placeholderImage:[UIImage imageNamed:@"200*200"]];
    _personDescribeLabel.text = hostList.personDescribe;
    _tracksCountsLabel.text = [NSString stringWithFormat:@"%@", hostList.tracksCounts];
    if ([hostList.followersCounts integerValue] < 10000.0) {
        _followersCountsLabel.text = [NSString stringWithFormat:@"%@", hostList.followersCounts];
    }else{
        
        _followersCountsLabel.text = [NSString stringWithFormat:@" %.1f万", [hostList.followersCounts integerValue] / 10000.0];
    }
}
@end
